import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store/modules'
import ElementPlus from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import './permission'
import 'element-plus/dist/index.css'
import '@/styles/index.scss'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs' // 修改为正确的语言包路径
// 处理 ResizeObserver 错误
const resizeObserverError = 'ResizeObserver loop completed with undelivered notifications.'
const originalError = window.console.error
window.console.error = (...args: any[]) => {
  if (args[0] === resizeObserverError) {
    return
  }
  originalError.apply(window.console, args)
}

const app = createApp(App)
// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(store)
app.use(router).use(ElementPlus, { locale: zhCn }).mount('#app')
